<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let r = 0;
      function sum(n) {
        r += n;
        return sum;
      }
      /*
        sum(1) n = 1
        sum(2) n = 2
        sum(3) n = 3
      */
      sum(1)(2)(3)(10)(45);
      console.log(r);
    </script>
  </body>
</html>
